<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>grid-demo01</title>
    <style>
        body {
            height: 100vh;
            margin: 0;
            padding: .5rem;
            box-sizing: border-box;
        }
        .grid {
            height: 100%;
            /* 将元素设为网格容器 */
            display: grid;
            /* 定义等宽的三列 */
            /* grid-template-columns: repeat(2, 1fr); */
            /* 定义等高的两行 */
            grid-template-rows: 1fr 1fr 1fr 1fr;
            /* 给每个网格的单元格之间加上间隔 */
            gap: 0.5em;
        }
        .grid > * {
            background-color: darkgray;
            color: white;
            padding: 2em;
            border-radius: .5em;
        }
        .a {
            /* grid-column: 1 / 2; */
            /* grid-row: 1 / 4; */
            /* 上面一句等价于下面两句 */
            grid-row-start: 1;
            grid-row-end: 4;
        }
        .b {
            grid-column: 2 / 4;
            grid-row: 1 / 2;
        }
        .c {
            grid-column: 2 /3;
            grid-row: 2 / 3;
        }
        .d {
            grid-column: 3/4;
            grid-row: 2/4;
        }
        .f {
            grid-column: 1/3;
            grid-row: 4/5;
        }
    </style>
</head>
<body>
    <div class="grid">
        <div class="a">a</div>
        <div class="b">b</div>
        <div class="c">c</div>
        <div class="d">d</div>
        <div class="e">e</div>
        <div class="f">f</div>
        <div class="g">g</div>
        <!-- <div class="h">h</div> -->
        <!-- <div class="i">i</div> -->
    </div>
</body>
</html>